package com.ruicar.afs.cloud.basic.proceeds.debit.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ruicar.afs.cloud.basic.proceeds.debit.condition.DebitBatchCondition;
import com.ruicar.afs.cloud.basic.proceeds.debit.entity.BasicDebitBatch;
import com.ruicar.afs.cloud.basic.proceeds.debit.entity.BasicDebitRecord;
import com.ruicar.afs.cloud.common.modules.contract.enums.DebitModeEnum;
import com.ruicar.afs.cloud.easypass.process.dto.RecResultQryDTO;

import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * @author: Lee
 * @date 2020-05-30 04:34:34 
 * @description 
 */
public interface BasicDebitBatchService extends IService<BasicDebitBatch> {

    /**
     * 全量生成扣款批次
     * @author ZC.GUO
     * @param
     * @return
     */
    public Integer generateDebitBatch(Date batchDate) throws ExecutionException, InterruptedException;

    /**
     * 根据指定条件生成扣款批次
     * @author ZC.GUO
     * @param debitBatchCondition 条件封装
     * @return 
     */
    public Integer generateDebitBatchByCondition(DebitBatchCondition debitBatchCondition, Date batchDate);
    /**
     * 指定单个合同生成批次并发送扣款
     * @author ZC.GUO
     * @param contractNo 合同号
     * @return
     */
    public boolean generateBatchAndSendByContractNo(String contractNo, Date batchDate);
    
    /**
     * 发送所有可发送的扣款批次
     * @author ZC.GUO
     * @param 
     * @return 
     */
    public void sendAllBatch();

    /**
     *
     * <p>Description: 按照扣款银行生成扣款批次</p>
     *
     * @param basicDebitRecordList 需要生成扣款批次的待扣款信息
     * @return
     */
    public Integer generateDebitBatchByList(List<BasicDebitRecord> basicDebitRecordList, Date batchDate);

    /**
     *
     * <p>Description: 删除扣款批次</p>
     * @author ZC.GUO
     * @param debitBatch 批次
     * @return
     */
    public String deleteDebitBatch(BasicDebitBatch debitBatch);


    /**
     * 批次锁定或解锁
     * @author ZC.GUO
     * @param basicDebitBatch 批次
     * @return
     */
    public boolean lockOrUnlockBatch(BasicDebitBatch basicDebitBatch);

    /**
     * 扫描并处理提前还款扣款指令(批次回盘或批次删除后执行)
     * @author ZC.GUO
     * @param
     * @return
     */
    public void scanAndDealPrepaymentDebitOrder();
    /**
     *
     * <p>Description: 发送扣款批次进行扣款</p>
     * @author ZC.GUO
     * @param debitBatch 批次
     * @param debitModeEnum 扣款模式，自动、手动
     * @return
     */
    public String sendDebitBatch(BasicDebitBatch debitBatch, DebitModeEnum debitModeEnum);
    /**
     *
     * <p>Description: 查询批次扣款结果</p>
     * @author ZC.GUO
     * @param debitBatch 批次
     * @return
     */
    public void queryDebitBatchResult(BasicDebitBatch debitBatch, Date batchDate);


    /**
     * 处理批次扣款结果
     * @author ZC.GUO
     * @param recResultQryDTO 扣款批次结果
     * @return 
     */
    public boolean handleDebitResultCallBack(RecResultQryDTO recResultQryDTO,String msgId, Date batchDate);

}
